<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="common/common_head :: commonHeader('编辑物料主数据信息')"/>
    <link th:href="@{/css/plugins/datapicker/datepicker3.css}" rel="stylesheet">
</head>

<body class="gray-bg">

<div class="wrapper wrapper-content animated fadeInRight">
    <form class="form-horizontal" method="post" id="materialFrom">
        <div class="row">
            <div class="form-group">
                <div class="col-sm-8" style="margin-left: 16px">
                    <input class="btn btn-primary" type="button" onclick="save()" value="保存">
                    <button class="btn btn-primary" type="button" onclick="Dialog.closeFrame(window.name)">取 消</button>
                </div>
            </div>
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>物料主数据信息</h5>
                </div>
                <div class="ibox-content">
                    <div class="form-group">
                        <label class="col-xs-1 control-label"><span class="required-sign">*</span>物料号：</label>
                        <div class="col-xs-3">
                            <input name="materialId" th:value="${materialEntity.materialId}" readonly="readonly" type="hidden" />
                            <input name="materialCode" th:value="${materialEntity.materialCode}" readonly="readonly" type="text" class="form-control"/>
                        </div>
                        <label class="col-xs-1 control-label">物料描述：</label>
                        <div class="col-xs-3">
                            <input name="materialDesc" th:value="${materialEntity.materialDesc}" type="text" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-1 control-label">物料类型</label>
                            <div class="col-xs-3">
                                <select class="form-control" id="materialType" name="materialType" sysDict="WULX" emptyFirst="false"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-1 control-label">单位</label>
                        <div class="col-xs-3">
                            <select class="form-control" id="basicUnit" name="basicUnit" sysDict="JLDW" emptyFirst="false"></select>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<!--引入公共js-->
<div th:include="common/onload_js :: onloadJS"></div>
<!-- Chosen -->
<script th:src="@{/static/js/plugins/chosen/chosen.jquery.js}"></script>
<script type="text/javascript">
    $(function () {
        initDictDataSel();//初始化所有字典数据
    });
    //控制输入数字的大小
    function change(id) {
        //得到输入的值
        var str= $("#qualityMark").val();
        var str1= $("#serviceMark").val();
        if(id=="qualityMark"){
            if(str>60){
                alert("请输入小于待发货的量");
                $("#qualityMark").val("");
            }
            if(str<0){
                alert("请输入正确的发货量");
                $("#qualityMark").val("");
            }
        }
        if(id=="serviceMark"){
            if(str1>10){
                alert("请输入小于待发货的量");
                $("#serviceMark").val("");
            }
            if(str1<0){
                alert("请输入正确的发货量");
                $("#serviceMark").val("");
            }
        }
    }

    //保存
    function save() {
        if($("#materialFrom").valid()) {
            Page.ajaxPOST(ctxPath + "/material/update", $('#materialFrom').serialize(), function (res) {
                Dialog.msg("更新成功!",function(){
                    parent.refresh();
                    Dialog.closeFrame(window.name);
                });
            }, {"loadingMsg" : "正在往服务器提交数据……"});
        }
    }
</script>

</body>
</html>
